import {AbstractService} from "./abstractService";
import {apiConfig, httpServer} from "../serverConfig/serverManager";

export class MessageService extends AbstractService {
  constructor() {
    super();
  }

  queryMessage() {
    const cmd = apiConfig.message.queryMessage;
    return httpServer.getData(cmd, null).then(res => res.data)
  }

  queryComment(id) {
    const cmd = apiConfig.message.queryComment;
    const data = {
      id: id
    }
    return httpServer.getData(cmd, data).then(res => res.data)
  }

  sendComment(id, message) {
    const cmd = apiConfig.message.sendComment;
    const data = {
      id: id,
      message: message
    }
    return httpServer.postData(cmd, data).then(res => res.data)
  }

  deleteComment(id) {
    const cmd = apiConfig.message.deleteComment;
    const data = {
      id: id
    }
    return httpServer.deleteData(cmd, data).then(res => res.data)
  }
}
